package com.open.capacity.controller;

import com.github.pagehelper.PageInfo;
import com.open.capacity.common.web.Result;
import com.open.capacity.model.PageModel;
import com.open.capacity.model.Station;
import com.open.capacity.service.StationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/business/station")
public class StationController {

    @Autowired
    private StationService stationService;
    @PostMapping("/add")
    public Result add(Station station){
        stationService.add(station);
        return Result.succeed("工位添加成功");
    }
    @PostMapping("/delete")
    public Result delete(Long statid){
        stationService.delete(statid);
        return Result.succeed("工位删除成功");
    }
    @PostMapping("/update")
    public Result update(Station station){
        stationService.update(station);
        return Result.succeed("工位修改成功");
    }
    @GetMapping("/findPage")
    public Result findPage(PageModel page,Station station){
        PageInfo list = stationService.findPage(page,station);
        return Result.succeed(list,"工位shuju显示成功");
    }
    @GetMapping("/findById")
    public Result findById(Long statid){
        Station station = stationService.findById(statid);
        return Result.succeed(station,"工位编辑数据显示成功");
    }
}
